package cn.wit.luohui.day08;

public class Employee implements Comparable<Employee>{

	private String name;
	private int salary;
	private int age;
	
	public Employee() {}
	
	public Employee(String name,int age) {
		this.age=age;
		this.name=name;
		
	}
	
	public Employee(String name,int salary,int age) {
		this.age=age;
		this.name=name;
		this.salary=salary;
	}
	
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getSalary() {
		return salary;
	}
	public void setSalary(int salary) {
		this.salary = salary;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public void foo() {
		// TODO Auto-generated method stub
		
	}
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Employee [name=");
		builder.append(name);
		builder.append(", salary=");
		builder.append(salary);
		builder.append(", age=");
		builder.append(age);
		builder.append("]");
		return builder.toString();
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + age;
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		result = prime * result + salary;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Employee other = (Employee) obj;
		if (age != other.age)
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		if (salary != other.salary)
			return false;
		return true;
	}



	@Override
	public int compareTo(Employee arg0) {
		// TODO Auto-generated method stub
		return this.age - arg0.age;
	}


//
//	@Override
//	public int compareTo(Object o) {
//		// TODO Auto-generated method stub
//		return this.age - o.age;
//	}


//	public int test() {
//		return this.age-e2.age;
//	}

}
